import requests
from config import url_cloud,headers_web

class Appointment:
    def __int__(self):
        self.url = url_cloud
        self.headers = url_cloud

    @classmethod
    def get_appointmentsStatus(cls,url_cloud:str,params=None,headers=headers_web):
        '''
        summary:获取所有预约状态
        description:前端
        :param url_cloud:
        :param params:
        :param headers:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/status"
        r = requests.get(url=url,params=params,headers=headers)
        return r

    @classmethod
    def get_datetimespanstatusstudentList(cls,url_cloud:str,params=None,headers=headers_web):
        '''
        summary:学生预约根据班级id获取班级成员是否空闲信息
        description:Web端学生实验室预约
        :param url_cloud:
        :param params:
        :param headers:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/datetimespanstatusstudentList"
        r = requests.get(url=url,params=params,headers=headers)
        return r

    @classmethod
    def get_appointmentsubscriber(cls, url_cloud: str, params=None, headers=headers_web,paramspath=None):
        '''
        summary:获取预约人员信息接口(分页)
        description:云课堂web端
        :param url_cloud:
        :param params:
        :param headers:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/appointments/appointmentsubscriber/{paramspath}"
        r = requests.get(url=url, params=params, headers=headers)
        return r

    @classmethod
    def get_appointmentdetail(cls, url_cloud: str, params=None, headers=headers_web, paramspath=None):
        '''
        summary:获取预约记录详情信息接口文档
        description:云课堂web端
        :param url_cloud:
        :param params:
        :param headers:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/appointments/appointmentdetail/{paramspath}"
        r = requests.get(url=url, params=params, headers=headers)
        return r

    @classmethod
    def post_submitappointment(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:提交预约申请单
        description:Web端提交预约申请单、微信小程序提交预约申请单
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/submitappointment"
        r = requests.post(url=url, params=params, headers=headers, json=json)
        return r
    @classmethod
    def post_cancelappointment(cls, url_cloud: str, params=None, headers=headers_web, paramspath=None,json=None):
        '''
        summary:取消预约记录
        description:云课堂web端
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :param paramspath:
        :return:
        '''
        url = url_cloud + f"/teachinglaboratoryapi/v1/appointments/{paramspath}/cancelappointment"
        r = requests.post(url=url, params=params, headers=headers,json=json)
        return r

    @classmethod
    def post_submitaudit(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:审核预约记录
        description:云课堂web管理端
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/submitaudit"
        r = requests.post(url=url, params=params, headers=headers,json=json)
        return r

    @classmethod
    def post_checkaudit(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:审核检查
        description:云课堂wenb管理端
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/checkaudit"
        r = requests.post(url=url, params=params, headers=headers, json=json)
        return r

    @classmethod
    def post_applicationlistexport(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:导出预约记录
        description:云课堂wenb管理端
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/appointmentapplicationlist/export"
        r = requests.post(url=url, params=params, headers=headers, json=json)
        return r

    @classmethod
    def post_applicationlist(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:管理员查看预约记录
        description:云课堂wenb管理端
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments/appointmentapplicationlist"
        r = requests.post(url=url, params=params, headers=headers, json=json)
        return r

    @classmethod
    def post_appointments(cls, url_cloud: str, params=None, headers=headers_web, json=None):
        '''
        summary:根据关键字、预约日期段、预约状态、学生id查询该学生的预约申请单
        description:Web端学生查询预约申请单使用
        :param url_cloud:
        :param params:
        :param headers:
        :param json:
        :return:
        '''
        url = url_cloud + "/teachinglaboratoryapi/v1/appointments"
        r = requests.post(url=url, params=params, headers=headers, json=json)
        return r